home *** CD-ROM | disk | FTP | other *** search
- unit Sessionf;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, MXMAILX;
-
- {$I mailxdef.int}
- type
- TSimpleForm = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- szNames: TEdit;
- szCount: TLabel;
- btlResolve: TButton;
- Button2: TButton;
- Button3: TButton;
- Button4: TButton;
- Button5: TButton;
- Button6: TButton;
- btnLogin: TButton;
- MXForm1: TMXForm;
- MXSession1: TMXSession;
- MXMessage1: TMXMessage;
- MXRecipient1: TMXRecipient;
- procedure FormCreate(Sender: TObject);
- procedure btnLoginClick(Sender: TObject);
- procedure btlResolveClick(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button5Click(Sender: TObject);
- function IsSessionActive:Boolean;
- procedure Button2Click(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- procedure Button6Click(Sender: TObject);
- procedure UpdateText;
- procedure UpdateCount;
-
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- SimpleForm: TSimpleForm;
-
- implementation
-
- {$R *.DFM}
- uses mailsys2;
-
-
- procedure TSimpleForm.FormCreate(Sender: TObject);
- var
- MailSystem: TMailSystem;
- begin
- MailSystem:=TMailSystem.Create(Self);
- MailSystem.ShowModal;
- MailSystem.free;
-
- end;
-
- procedure TSimpleForm.btnLoginClick(Sender: TObject);
- begin
- MXSession1.Logon:=TRUE;
- if IsSessionActive then
- begin
- UpdateCount;
- end
- else
- begin
- szNames.Text:='';
- szCount.Caption:='';
- end;
-
- end;
-
- procedure TSimpleForm.btlResolveClick(Sender: TObject);
- begin
- if IsSessionActive then
- begin
- MXRecipient1.ResolveName:=szNames.Text;
- szNames.Text:=MXRecipient1.ResolveName;
- end;
- end;
-
- procedure TSimpleForm.UpdateText;
- begin
- if MXRecipient1.RecipientCount=0 then szNames.Text:=''
- else szNames.Text:=MXRecipient1.RecipientName;
- end;
-
- procedure TSimpleForm.UpdateCount;
- begin
- szCount.Caption:=IntToStr(MXRecipient1.RecipientCount);
- end;
-
- procedure TSimpleForm.Button3Click(Sender: TObject);
- begin
- if IsSessionActive then
- begin
- MXRecipient1.Action:=ACTION_ADDRECIPIENT;
- UpdateCount;
- UpdateText;
- end;
- end;
-
- procedure TSimpleForm.Button5Click(Sender: TObject);
- begin
- if IsSessionActive then
- begin
- MXRecipient1.Action:=ACTION_ADDRESS;
- UpdateCount;
- UpdateText;
- end;
- end;
-
- function TSimpleForm.IsSessionActive:Boolean;
- begin
- if MXSession1.Logon=TRUE then
- begin
- Result:=TRUE;
- end
- else
- begin
- Application.MessageBox('No Active Session available',
- 'Mail eXtension DEMO for DELPHI',
- MB_ICONSTOP);
- Result:=FALSE;
- end;
- end;
-
- procedure TSimpleForm.Button2Click(Sender: TObject);
- var
- NextR: Integer;
- begin
- if IsSessionActive then
- begin
- If MXRecipient1.RecipientCount > 0 Then
- begin
- MXRecipient1.RecipientNum:= 1;
- UpdateText;
- end
- Else
- begin
- Application.MessageBox('Mail X Recipient Control is Empty',
- 'Mail X DEMO for DELPHI',
- MB_ICONINFORMATION);
- end;
- end;
- end;
-
- procedure TSimpleForm.Button4Click(Sender: TObject);
- var
- NextR: Integer;
- begin
- if IsSessionActive then
- begin
- NextR:= MXRecipient1.RecipientNum + 1;
- If NextR <= MXRecipient1.RecipientCount Then
- begin
- MXRecipient1.RecipientNum := NextR;
- UpdateText;
- end
- Else
- begin
- Application.MessageBox('Last Recipient Reached',
- 'Mail X DEMO for DELPHI',
- MB_ICONINFORMATION);
- end;
- end;
- end;
-
- procedure TSimpleForm.Button6Click(Sender: TObject);
- begin
- if IsSessionActive then
- begin
- MXRecipient1.Action:= ACTION_DEL_RECIPIENT;
- UpdateCount;
- UpdateText;
- end;
- end;
-
- end.
-
-